package com.ruoyi.system.utils;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 用户工具
 */
@Component
public class SysUserUtils {


    private static SysUserMapper userMapper;

    @Autowired
    public SysUserUtils(SysUserMapper mapper) {
        userMapper = mapper;
    }


    /***
     * 获取酷家乐用户id
     * @return
     */
    public static String getKujialeId() {
        Long currentUserId = SecurityUtils.getUserId();
        SysUser sysUser = userMapper.selectById(currentUserId);
        return sysUser.getKujialeId();
    }

    /***
     * 获取酷家乐用户id
     * @return
     */
    public static String getKujialeIdBySysUserId(Long currentUserId) {
        SysUser sysUser = userMapper.selectById(currentUserId);
        return sysUser.getKujialeId();
    }
}
